Figures in {ggplot}

An Bui

Today

  • “Publication quality” definitions and figure sharing
  • General rules for data visualization
  • Design soapbox
  • Resources (not covered, just collected)
  • Playing around with code

“Publication quality” definitions and figure sharing

“Publication quality”

  • easily digestible
  • accessible: communicates in color or black and white, color-blind friendly
  • scalable: image resizing without losing resolution
  • stand-alone-able: tells a story behind the author’s question, synthesizes an abstract topic

Figure sharing!

The Andes Through Time: Evolution and Distribution

of Andean Floras (Perez-Escobar et al. 2022)

General rules for data visualization

General rule #1: Convey the message

  • Legends and labels
  • Legible text, symbols, etc.
  • Clearly visible data
  • Intuitive color scheme
  • Redundancy

Source: palmerpenguins package

General rule #2: Minimize noise

  • Use colors sparingly (color-blind friendly choices are great too)
  • Minimize crowding

Source: palmerpenguins package

Design soapbox

Design soapbox

  • Figures can’t always be reused
  • Make your friends critique your figures
  • Kill your darlings
  • Always consider the audience!

Resources

General Data Visualization
- Fundamentals of Data Visualization, by Claus O. Wilke
- R for Data Science (Ch. 3), by Garrett Grolemund & Hadley Wickham
- A ggplot2 grammar guide, by Gina Reynolds
- ggplot2 cheat sheet
- ggplot2: Elegant Graphics for Data Analysis, by Hadley Wickham

Plot themes/customization
- Modifying components of a theme
- Themes to Improve your ggplot Figures, by David Keyes

Packages
- patchwork (for putting plots together)
- cowplot (also for putting plots together)
- ggtext package (improved text rendering support for ggplot2)

Other
- stat_summary() tutorial, by Christian Burkhart

On to the code!